package net.hn.hnms.biz.common.activiti.params;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * Created on 2022/8/1.
 *
 * @author ly
 * @desc: 动态流程创建参数
 */
@ApiModel("动态流程创建参数")
public class ProcessParam implements Serializable {

    @ApiModelProperty("流程名称")
    @NotBlank(message = "流程名称不能为空")
    @Length(max = 128, message = "流程名称最长128个字符")
    private String processName;

    @ApiModelProperty("流程描述")
    @Length(max = 128, message = "流程描述最长255个字符")
    private String processContent;

    @ApiModelProperty("流程创建人")
    @NotBlank(message = "流程创建人不能为空")
    private String creator;

    @ApiModelProperty("流程步骤")
    private List<ProcessStepParam> steps = new ArrayList<>();

    public String getProcessName() {
        return processName;
    }

    public void setProcessName(String processName) {
        this.processName = processName;
    }

    public String getProcessContent() {
        return processContent;
    }

    public void setProcessContent(String processContent) {
        this.processContent = processContent;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator;
    }

    public List<ProcessStepParam> getSteps() {
        return steps;
    }

    public void addStep(ProcessStepParam stepRequest) {
        if (this.steps == null) {
            this.steps = new ArrayList<>();
        }
        this.getSteps().add(stepRequest);
    }

    public void addSteps(List<ProcessStepParam> stepRequests) {
        if (this.steps == null) {
            this.steps = new ArrayList<>();
        }
        this.getSteps().addAll(stepRequests);
    }
}
